package ilender.models;

import java.io.Serializable;

import org.joda.time.DateTime;
import org.joda.time.DateMidnight;
import lombok.*;

@Data @NoArgsConstructor @EqualsAndHashCode(callSuper=false)
public class MOffer extends BaseModel{
	private MRequest request;
	private MItem item;
	private DateTime offered_at;
	private long offered_by_id; //This is the id of the facebook user who created the offer
	private boolean item_owner_agreed;
	private boolean requester_agreed;
	private boolean canceled;
	private DateMidnight return_due_date;
	private DateTime return_actual_time;
	private boolean another_offer_accepted;
	private DateTime last_notification_time ;

	public void setRequest_id(long request_id){
		if(null==request || request.getId()!=request_id){
			request=new MRequest();
			request.setId(request_id);
		}
	}
	public long getRequest_id(){
		if(null==request)
			return 0;
		return request.getId();
	}

	public void setItem_id(long item_id){
		if(null==item || item.getId()!=item_id){
			item=new MItem();
			item.setId(item_id);
		}
	}
	public long getItem_id(){
		if(null==item)
			return 0;
		return item.getId();
	}
}
